package com.ruoyi.report.service.Impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.report.mapper.ReportWorkbookDataMapper;
import com.ruoyi.report.domain.ReportWorkbookData;
import com.ruoyi.report.service.IReportWorkbookDataService;

/**
 * 报工作簿数据Service业务层处理
 * 
 * @author sunyan
 * @date 2022-03-14
 */
@Service
public class ReportWorkbookDataServiceImpl implements IReportWorkbookDataService 
{
    @Autowired
    private ReportWorkbookDataMapper reportWorkbookDataMapper;

    /**
     * 查询报工作簿数据
     * 
     * @param reportId 报表id，sheetId 索引
     * @return 报工作簿数据
     */
    @Override
    public ReportWorkbookData selectReportWorkbookDataById(Long reportId,String sheetIndex)
    {
        return reportWorkbookDataMapper.selectReportWorkbookDataById(reportId,sheetIndex);
    }

    /**
     * 查询报工作簿数据列表
     * 
     * @param reportId 报工作簿数据
     * @return 报工作簿数据
     */
    @Override
    public List<String> selectReportWorkbookDataByReportId(Long reportId)
    {
        return reportWorkbookDataMapper.selectReportWorkbookDataByReportId(reportId);
    }

    /**
     * 新增报工作簿数据
     * 
     * @param reportWorkbookData 报工作簿数据
     * @return 结果
     */
    @Override
    public int insertReportWorkbookData(ReportWorkbookData reportWorkbookData)
    {
        return reportWorkbookDataMapper.insertReportWorkbookData(reportWorkbookData);
    }

    /**
     * 修改报工作簿数据
     * 
     * @param reportWorkbookData 报工作簿数据
     * @return 结果
     */
    @Override
    public int updateReportWorkbookData(ReportWorkbookData reportWorkbookData)
    {
        reportWorkbookData.setUpdateTime(DateUtils.getNowDate());
        return reportWorkbookDataMapper.updateReportWorkbookData(reportWorkbookData);
    }

    /**
     * 批量删除报工作簿数据
     * 
     * @param ids 需要删除的报工作簿数据主键
     * @return 结果
     */
    @Override
    public int deleteReportWorkbookDataByIds(Long[] ids)
    {
        return reportWorkbookDataMapper.deleteReportWorkbookDataByIds(ids);
    }

    /**
     * 删除报工作簿数据信息
     * 
     * @param reportId 报表id
     * @return 结果
     */
    @Override
    public int deleteReportWorkbookDataByReportId(Long reportId)
    {
        return reportWorkbookDataMapper.deleteReportWorkbookDataByReportId(reportId);
    }
    /**
     * 查询报工作簿序号
     *
     * @param reportId 报表id
     * @return 报工作簿首页序号
     */
    @Override
    public List<ReportWorkbookData> selectReportSheetIndexByReportId(Long reportId) {
        return reportWorkbookDataMapper.selectReportSheetIndexByReportId(reportId);
    }
}
